{
  "name": "Case 62 - Industry Influencer Sentiment Tracker",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * 1"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -1008,
        -80
      ],
      "id": "8fe930b1-441d-49e9-a0d1-b20a535165c1",
      "name": "Weekly Schedule - Monday 9 AM"
    },
    {
      "parameters": {
        "actorId": {
          "__rl": true,
          "value": "buIWk2uOUzTmcLsuB",
          "mode": "list",
          "cachedResultName": "Linkedin Post Search Scraper (No Cookies) (harvestapi/linkedin-post-search)",
          "cachedResultUrl": "https://console.apify.com/actors/buIWk2uOUzTmcLsuB/input"
        },
        "customBody": "{\n    \"authorUrls\": [\n        \"https://www.linkedin.com/in/andrew-ng\",\n        \"https://www.linkedin.com/in/pascal-bornet\",\n        \"https://www.linkedin.com/in/alliekmiller\",\n        \"https://www.linkedin.com/in/bernardmarr\",\n        \"https://www.linkedin.com/in/cassie-kozyrkov\"\n    ],\n    \"maxPosts\": 20,\n    \"maxReactions\": 5,\n    \"postedLimit\": \"month\",\n    \"scrapeComments\": false,\n    \"scrapeReactions\": false\n}"
      },
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        -816,
        -80
      ],
      "id": "8d7beeba-7127-4e69-84c0-825e58f1802c",
      "name": "Scrape LinkedIn Influencer Posts",
      "credentials": {
        "apifyApi": {
          "id": "w5S6YBbbyUddEfQA",
          "name": "Apify account"
        }
      }
    },
    {
      "parameters": {
        "resource": "Datasets",
        "datasetId": "={{ $json.defaultDatasetId }}",
        "limit": 100
      },
      "type": "@apify/n8n-nodes-apify.apify",
      "typeVersion": 1,
      "position": [
        -608,
        -80
      ],
      "id": "023846f7-f027-4611-8303-32c8aa9b568e",
      "name": "Get Dataset Items",
      "credentials": {
        "apifyApi": {
          "id": "w5S6YBbbyUddEfQA",
          "name": "Apify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "condition-001",
              "leftValue": "={{ $json.content }}",
              "rightValue": "AI automation",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "condition-002",
              "leftValue": "={{ $json.content }}",
              "rightValue": "intelligent automation",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "condition-003",
              "leftValue": "={{ $json.content }}",
              "rightValue": "workflow automation",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "condition-004",
              "leftValue": "={{ $json.content }}",
              "rightValue": "AI agents",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "condition-005",
              "leftValue": "={{ $json.content }}",
              "rightValue": "process automation",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "condition-006",
              "leftValue": "={{ $json.content }}",
              "rightValue": "automation strategy",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        -400,
        -80
      ],
      "id": "4b968876-8f40-410c-81fa-f5a59297fba9",
      "name": "Filter AI Automation Keywords"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4o-mini"
        },
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "=You are an AI Sentiment Analysis Expert specializing in LinkedIn influencer content analysis.\n\nExtract sentiment and key insights from LinkedIn posts about AI automation.\n\nReturn ONLY valid JSON in this exact format:\n{\n  \"sentiment\": \"positive|negative|neutral\",\n  \"confidence_score\": 0.85,\n  \"stance\": \"supportive|critical|balanced|neutral\",\n  \"key_arguments\": [\"argument 1\", \"argument 2\", \"argument 3\"],\n  \"emotional_tone\": \"professional|passionate|cautious|critical|optimistic|concerned\",\n  \"topic_category\": \"AI automation|intelligent automation|workflow automation|AI agents|process automation|automation strategy\",\n  \"business_implications\": \"brief description of mentioned business/policy impacts or null\"\n}\n\nRules:\n1. sentiment must be one of: positive, negative, neutral\n2. confidence_score between 0 and 1 (how confident you are in sentiment assessment)\n3. stance captures overall position on the topic\n4. Extract maximum 3 key arguments - the main points being made\n5. emotional_tone captures the writing style and emotion\n6. topic_category must match one of the provided categories\n7. business_implications: summarize any mentioned impact on business, policy, or industry (1 sentence max)\n8. Return ONLY the JSON object, no explanations"
            },
            {
              "content": "=Analyze this LinkedIn post for sentiment and key insights:\n\nAuthor: {{ $json.author.name }}\nPost Date: {{ $json.postedAt.date }}\nPost Text: {{ $json.content }}\n\nReturn only JSON."
            }
          ]
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        -208,
        -80
      ],
      "id": "349098fd-f524-487b-8be8-e7c575d711b5",
      "name": "AI Sentiment Analysis",
      "credentials": {
        "openAiApi": {
          "id": "ICwxUBbatsF2sDvy",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1GLjosJxue_mhpX_6FiEnhPDs__7kks2ivTSAuUsksCM",
          "mode": "list",
          "cachedResultName": "Case 62 - Influencer Sentiment Log",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GLjosJxue_mhpX_6FiEnhPDs__7kks2ivTSAuUsksCM/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GLjosJxue_mhpX_6FiEnhPDs__7kks2ivTSAuUsksCM/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Analysis_Date": "={{ $json.analysis_timestamp }}",
            "Influencer_Name": "={{ $json.influencer_name }}",
            "Post_Date": "={{ $json.post_date }}",
            "Topic_Category": "={{ $json.topic_category }}",
            "Sentiment": "={{ $json.sentiment }}",
            "Confidence_Score": "={{ $json.confidence_score }}",
            "Stance": "={{ $json.stance }}",
            "Emotional_Tone": "={{ $json.emotional_tone }}",
            "Key_Arguments": "={{ $json.key_arguments.join('; ') }}",
            "Business_Implications": "={{ $json.business_implications }}",
            "Likes": "={{ $json.likes_count }}",
            "Comments": "={{ $json.comments_count }}",
            "Shares": "={{ $json.shares_count }}",
            "Total_Engagement": "={{ $json.engagement_total }}",
            "Post_URL": "={{ $json.post_url }}",
            "Post_Text": "={{ $json.post_text }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Analysis_Date",
              "displayName": "Analysis_Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Influencer_Name",
              "displayName": "Influencer_Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Post_Date",
              "displayName": "Post_Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Topic_Category",
              "displayName": "Topic_Category",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Sentiment",
              "displayName": "Sentiment",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Confidence_Score",
              "displayName": "Confidence_Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "Stance",
              "displayName": "Stance",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Emotional_Tone",
              "displayName": "Emotional_Tone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Key_Arguments",
              "displayName": "Key_Arguments",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Business_Implications",
              "displayName": "Business_Implications",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Likes",
              "displayName": "Likes",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "Comments",
              "displayName": "Comments",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "Shares",
              "displayName": "Shares",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "Total_Engagement",
              "displayName": "Total_Engagement",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "Post_URL",
              "displayName": "Post_URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Post_Text",
              "displayName": "Post_Text",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        512,
        -80
      ],
      "id": "12028bc0-904a-44db-b50d-83237a5bdaef",
      "name": "Log to Google Sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "LOs2dbk9lby0NfDM",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Aggregate all items from Google Sheets into email-ready summary\nconst allItems = $input.all();\n\n// Calculate sentiment breakdown\nconst sentimentCounts = { positive: 0, negative: 0, neutral: 0 };\nallItems.forEach(item => {\n  const sentiment = (item.json.Sentiment || 'neutral').toLowerCase();\n  if (sentimentCounts.hasOwnProperty(sentiment)) {\n    sentimentCounts[sentiment]++;\n  }\n});\n\nconst totalPosts = allItems.length;\nconst sentimentPercentages = {\n  positive: Math.round((sentimentCounts.positive / totalPosts) * 100),\n  negative: Math.round((sentimentCounts.negative / totalPosts) * 100),\n  neutral: Math.round((sentimentCounts.neutral / totalPosts) * 100)\n};\n\n// Find trending arguments (most mentioned)\n// Key_Arguments is now a string like \"arg1; arg2; arg3\"\nconst argumentCounts = {};\nallItems.forEach(item => {\n  const argsString = item.json.Key_Arguments || '';\n  if (argsString) {\n    const args = argsString.split(';').map(arg => arg.trim()).filter(arg => arg);\n    args.forEach(arg => {\n      argumentCounts[arg] = (argumentCounts[arg] || 0) + 1;\n    });\n  }\n});\n\nconst trendingArguments = Object.entries(argumentCounts)\n  .sort((a, b) => b[1] - a[1])\n  .slice(0, 5)\n  .map(([arg, count]) => ({ argument: arg, mentions: count }));\n\n// Top influencers by engagement\nconst influencerEngagement = {};\nallItems.forEach(item => {\n  const name = item.json.Influencer_Name || 'Unknown';\n  if (!influencerEngagement[name]) {\n    influencerEngagement[name] = { total: 0, posts: 0 };\n  }\n  influencerEngagement[name].total += parseInt(item.json.Total_Engagement || 0);\n  influencerEngagement[name].posts++;\n});\n\nconst topInfluencers = Object.entries(influencerEngagement)\n  .map(([name, data]) => ({\n    name,\n    avg_engagement: Math.round(data.total / data.posts),\n    total_posts: data.posts\n  }))\n  .sort((a, b) => b.avg_engagement - a.avg_engagement)\n  .slice(0, 5);\n\n// Build HTML table rows for detailed posts\nconst tableRows = allItems.map(item => {\n  const data = item.json;\n  const sentiment = data.Sentiment || 'neutral';\n  const sentimentColor = sentiment.toLowerCase() === 'positive' ? '#28a745' : \n                         sentiment.toLowerCase() === 'negative' ? '#dc3545' : '#6c757d';\n  \n  return `\n    <tr>\n      <td>${data.Influencer_Name || 'N/A'}</td>\n      <td>${data.Post_Date || 'N/A'}</td>\n      <td><span style=\"color: ${sentimentColor}; font-weight: bold;\">${sentiment}</span></td>\n      <td>${data.Stance || 'N/A'}</td>\n      <td>${(parseInt(data.Total_Engagement || 0)).toLocaleString()}</td>\n      <td><a href=\"${data.Post_URL || '#'}\">View</a></td>\n    </tr>\n  `;\n}).join('');\n\n// Return single aggregated item\nreturn {\n  json: {\n    week_start: new Date(Date.now() - 7*24*60*60*1000).toISOString().split('T')[0],\n    week_end: new Date().toISOString().split('T')[0],\n    total_posts_analyzed: totalPosts,\n    sentiment_positive_pct: sentimentPercentages.positive,\n    sentiment_negative_pct: sentimentPercentages.negative,\n    sentiment_neutral_pct: sentimentPercentages.neutral,\n    trending_arguments: trendingArguments,\n    top_influencers: topInfluencers,\n    table_rows: tableRows,\n    all_posts: allItems.map(item => item.json)\n  }\n};"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        -80
      ],
      "id": "16c2965c-cede-4013-bd9e-3a9eb8d2dff1",
      "name": "Aggregate Weekly Summary"
    },
    {
      "parameters": {
        "sendTo": "strategy-team@yourcompany.com",
        "subject": "=📊 Weekly AI Automation Sentiment Report: {{ $json.week_start }} to {{ $json.week_end }}",
        "message": "=<html>\n<head>\n  <style>\n    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; line-height: 1.6; color: #333; }\n    .container { max-width: 900px; margin: 0 auto; padding: 20px; }\n    .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 10px 10px 0 0; }\n    .summary-box { background: #f8f9fa; padding: 20px; margin: 20px 0; border-radius: 8px; border-left: 4px solid #667eea; }\n    .metric { display: inline-block; margin: 10px 20px 10px 0; }\n    .metric-value { font-size: 32px; font-weight: bold; color: #667eea; }\n    .metric-label { font-size: 14px; color: #666; }\n    .sentiment-bar { height: 30px; background: #e9ecef; border-radius: 15px; overflow: hidden; margin: 10px 0; }\n    .sentiment-positive { background: #28a745; height: 100%; float: left; }\n    .sentiment-neutral { background: #6c757d; height: 100%; float: left; }\n    .sentiment-negative { background: #dc3545; height: 100%; float: left; }\n    .trending-list { list-style: none; padding: 0; }\n    .trending-list li { background: white; padding: 12px; margin: 8px 0; border-radius: 5px; border-left: 3px solid #667eea; }\n    .influencer-box { background: white; padding: 15px; margin: 10px 0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }\n    table { width: 100%; border-collapse: collapse; margin: 20px 0; background: white; }\n    th { background: #667eea; color: white; padding: 12px; text-align: left; }\n    td { padding: 10px; border-bottom: 1px solid #ddd; }\n    tr:hover { background: #f5f5f5; }\n    .footer { text-align: center; color: #666; font-size: 12px; margin-top: 30px; padding-top: 20px; border-top: 2px solid #ddd; }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    \n    <div class=\"header\">\n      <h1 style=\"margin: 0;\">📊 Weekly AI Automation Sentiment Report</h1>\n      <p style=\"margin: 10px 0 0 0; opacity: 0.9;\">{{ $json.week_start }} to {{ $json.week_end }}</p>\n    </div>\n    \n    <div class=\"summary-box\">\n      <h2 style=\"margin-top: 0; color: #667eea;\">📈 Sentiment Overview</h2>\n      <div class=\"metric\">\n        <div class=\"metric-value\">{{ $json.total_posts_analyzed }}</div>\n        <div class=\"metric-label\">Posts Analyzed</div>\n      </div>\n      \n      <div class=\"sentiment-bar\">\n        <div class=\"sentiment-positive\" style=\"width: {{ $json.sentiment_positive_pct }}%;\"></div>\n        <div class=\"sentiment-neutral\" style=\"width: {{ $json.sentiment_neutral_pct }}%;\"></div>\n        <div class=\"sentiment-negative\" style=\"width: {{ $json.sentiment_negative_pct }}%;\"></div>\n      </div>\n      \n      <div style=\"margin-top: 10px;\">\n        <span style=\"color: #28a745; font-weight: bold;\">● Positive: {{ $json.sentiment_positive_pct }}%</span> &nbsp;&nbsp;\n        <span style=\"color: #6c757d; font-weight: bold;\">● Neutral: {{ $json.sentiment_neutral_pct }}%</span> &nbsp;&nbsp;\n        <span style=\"color: #dc3545; font-weight: bold;\">● Negative: {{ $json.sentiment_negative_pct }}%</span>\n      </div>\n    </div>\n    \n    <div class=\"summary-box\">\n      <h2 style=\"margin-top: 0; color: #667eea;\">🔥 Trending Arguments This Week</h2>\n      <ul class=\"trending-list\">\n        {{ $json.trending_arguments.map(arg => `\n          <li>\n            <strong>\"${arg.argument}\"</strong>\n            <span style=\"float: right; color: #667eea; font-weight: bold;\">${arg.mentions} mentions</span>\n          </li>\n        `).join('') }}\n      </ul>\n    </div>\n    \n    <div class=\"summary-box\">\n      <h2 style=\"margin-top: 0; color: #667eea;\">👥 Top Influencers by Engagement</h2>\n      {{ $json.top_influencers.map((inf, index) => `\n        <div class=\"influencer-box\">\n          <strong>${index + 1}. ${inf.name}</strong>\n          <div style=\"color: #666; margin-top: 5px;\">\n            Avg Engagement: <strong style=\"color: #667eea;\">${inf.avg_engagement.toLocaleString()}</strong> &nbsp;|&nbsp; \n            Posts: ${inf.total_posts}\n          </div>\n        </div>\n      `).join('') }}\n    </div>\n    \n    <h2 style=\"color: #667eea; margin-top: 40px;\">📋 Detailed Post Analysis</h2>\n    <table>\n      <thead>\n        <tr>\n          <th>Influencer</th>\n          <th>Date</th>\n          <th>Sentiment</th>\n          <th>Stance</th>\n          <th>Engagement</th>\n          <th>Link</th>\n        </tr>\n      </thead>\n      <tbody>\n        {{ $json.table_rows }}\n      </tbody>\n    </table>\n    \n    <div class=\"footer\">\n      <p><strong>Report Generated:</strong> {{ new Date().toLocaleString() }}</p>\n      <p>Automated Influencer Sentiment Tracker | Case 62</p>\n    </div>\n    \n  </div>\n</body>\n</html>",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        912,
        -80
      ],
      "id": "64814542-281c-46cf-9c28-7253f1f3b9fa",
      "name": "Send Weekly Summary Email",
      "webhookId": "d2ab0ef3-3f3c-49ef-852b-45a82730634c",
      "credentials": {
        "gmailOAuth2": {
          "id": "cyqCGWcggZNMcSOv",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// UNIVERSAL AI RESPONSE PARSER - Same code for ALL cases\nconst items = [];\nconst input = $input.all();\n\nfunction extractJSON(text) {\n  const jsonMatch = text.match(/\\{[\\s\\S]*\\}/);\n  if (!jsonMatch) return null;\n  return jsonMatch[0];\n}\n\ninput.forEach((item, index) => {\n  try {\n    let aiText = item.json.output[0].content[0].text || '';\n    \n    // Clean markdown code blocks\n    aiText = aiText\n      .replace(/```json/gi, '')\n      .replace(/```/g, '')\n      .trim();\n    \n    // Extract JSON object\n    const jsonStr = extractJSON(aiText);\n    \n    if (!jsonStr) {\n      throw new Error('No JSON found in AI response');\n    }\n    \n    // Parse and return clean JSON\n    const parsed = JSON.parse(jsonStr);\n    items.push({ json: parsed });\n    \n  } catch (error) {\n    console.error(`Parse error for item ${index}:`, error.message);\n    // Return empty object on error - no case-specific fields\n    items.push({ json: {} });\n  }\n});\n\nreturn items;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        112,
        -80
      ],
      "id": "72dc27b5-bdc8-4e87-a06a-c5a89ce1a95e",
      "name": "Parse AI Response"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "timestamp",
              "name": "analysis_timestamp",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            },
            {
              "id": "influencer_name",
              "name": "influencer_name",
              "value": "={{ $('Filter AI Automation Keywords').item.json.author?.name || 'unknown' }}",
              "type": "string"
            },
            {
              "id": "influencer_profile",
              "name": "influencer_profile",
              "value": "={{ $('Filter AI Automation Keywords').item.json.author?.linkedinUrl || '' }}",
              "type": "string"
            },
            {
              "id": "post_text",
              "name": "post_text",
              "value": "={{ $('Filter AI Automation Keywords').item.json.content || '' }}",
              "type": "string"
            },
            {
              "id": "post_date",
              "name": "post_date",
              "value": "={{ $('Filter AI Automation Keywords').item.json.postedAt?.date || '' }}",
              "type": "string"
            },
            {
              "id": "post_url",
              "name": "post_url",
              "value": "={{ $('Filter AI Automation Keywords').item.json.linkedinUrl || '' }}",
              "type": "string"
            },
            {
              "id": "sentiment",
              "name": "sentiment",
              "value": "={{ $json.sentiment }}",
              "type": "string"
            },
            {
              "id": "confidence",
              "name": "confidence_score",
              "value": "={{ $json.confidence_score }}",
              "type": "number"
            },
            {
              "id": "stance",
              "name": "stance",
              "value": "={{ $json.stance }}",
              "type": "string"
            },
            {
              "id": "arguments",
              "name": "key_arguments",
              "value": "={{ $json.key_arguments }}",
              "type": "array"
            },
            {
              "id": "tone",
              "name": "emotional_tone",
              "value": "={{ $json.emotional_tone }}",
              "type": "string"
            },
            {
              "id": "category",
              "name": "topic_category",
              "value": "={{ $json.topic_category }}",
              "type": "string"
            },
            {
              "id": "implications",
              "name": "business_implications",
              "value": "={{ $json.business_implications }}",
              "type": "string"
            },
            {
              "id": "likes",
              "name": "likes_count",
              "value": "={{ $('Filter AI Automation Keywords').item.json.engagement?.likes || 0 }}",
              "type": "number"
            },
            {
              "id": "comments",
              "name": "comments_count",
              "value": "={{ $('Filter AI Automation Keywords').item.json.engagement?.comments || 0 }}",
              "type": "number"
            },
            {
              "id": "shares",
              "name": "shares_count",
              "value": "={{ $('Filter AI Automation Keywords').item.json.engagement?.shares || 0 }}",
              "type": "number"
            },
            {
              "id": "total_engagement",
              "name": "engagement_total",
              "value": "={{ ($('Filter AI Automation Keywords').item.json.engagement?.likes || 0) + ($('Filter AI Automation Keywords').item.json.engagement?.comments || 0) + ($('Filter AI Automation Keywords').item.json.engagement?.shares || 0) }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        336,
        -80
      ],
      "id": "a71301da-bba5-41ba-99ab-14c8967e512c",
      "name": "Edit Fields"
    }
  ],
  "pinData": {},
  "connections": {
    "Weekly Schedule - Monday 9 AM": {
      "main": [
        [
          {
            "node": "Scrape LinkedIn Influencer Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape LinkedIn Influencer Posts": {
      "main": [
        [
          {
            "node": "Get Dataset Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Dataset Items": {
      "main": [
        [
          {
            "node": "Filter AI Automation Keywords",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter AI Automation Keywords": {
      "main": [
        [
          {
            "node": "AI Sentiment Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Sentiment Analysis": {
      "main": [
        [
          {
            "node": "Parse AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Weekly Summary": {
      "main": [
        [
          {
            "node": "Send Weekly Summary Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Log to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Google Sheet": {
      "main": [
        [
          {
            "node": "Aggregate Weekly Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ea3dc47f-f957-45fc-9c6b-5f4ed3c2c0d2",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "3a43da28588548e21903e71cf1dc3ddd65c24bf0c62e7e4b77542ffe87ad79c6"
  },
  "id": "fmJQjmsU8aABpExZ",
  "tags": []
}